
public class Caisse {
	int etatCommande;
	int id;
	boolean deluxe;
	
	Caisse(int id) {
		super();
		etatCommande = 0;
		this.id = id;
	}

	
	public boolean isDeluxe() {
		return deluxe;
	}

	public int getId() {
		return id;
	}

	synchronized void pretPourCommande(){
		while (etatCommande!=1){
			try {
				wait();
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}	
	}
	
	synchronized void nouvelleCommande(boolean isDeluxe){
		while (etatCommande!=0){
			try {
				wait();
				
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
		this.deluxe = isDeluxe;
		etatCommande=1;
		notifyAll();
	}
	
	synchronized void commandePrete(){
		etatCommande=2;
		notifyAll();
	}
	
	synchronized void prendCommande(){
		
		while (etatCommande!=2){
			try {
				wait();
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
		etatCommande=0;
		notifyAll();
	}
}
